<template>
	<view>
		<u-navbar :is-back="true" :custom-back="BackM" title="代理新增商户" back-text="">
			<!-- :custom-back="BackM" -->
		</u-navbar>
		<view class="totle-price">
			<view class="totle-price-text"> 总交易额：<span>¥898979.00</span> </view>

			<view @click="selectTimeM" :style="{
          display: 'flex',
          justifyContent: 'center',
          alignItems: 'center',
          backgroundColor: 'white',
          borderRadius: '5px',
          padding: '0.1rem',
        }">
				<!-- <image :style="{  width:'1rem',height:'1rem' }" src="../../style/image/stati/A33.png" alt="">
         <view :style="{ fontSize:'0.6rem', padding:'0rem 0rem 0rem 0.5rem' }"  >{{selectTime}}</view> -->
				<TimeTest :selectTime="selectTime" @func="getMsgFormSon"></TimeTest>
			</view>
		</view>
		<view class="seniorityPP">
			<view class="seniorityP" v-for="(item, index) in showData" :key="index">
				<view class="seniority-item">
					<view :style="{ display: 'flex' }">
						<view>
							<u-avatar :src="item.headImg" mode="circle" :show-sex="true"></u-avatar>
						</view>
						<view :style="{
                padding: '0rem 1rem',
                display: 'flex',
                flexDirection: 'column',
                alignItems: 'center',
                justifyContent: 'space-around',
              }">
							<view class="seniority-s">{{
                item.nickName == null ? "暂无设置" : item.nickName
              }}</view>
							<view class="seniority-p">{{ item.phone }}</view>
						</view>
					</view>
					<view class="seniority-price">新增{{ item.newShopCount }}人</view>
				</view>
			</view>

			<u-empty style="margin-top: 2rem" v-if="showData.length == 0" text="暂无数据" mode="data"></u-empty>
		</view>
	</view>
</template>

<script lang='ts'>
	import {
		Component,
		Prop,
		Vue,
		Watch,
		Emit
	} from "vue-property-decorator";

	import TimeTest from "../../views/test/timeTest.vue";

	import {
		porxyNewShopRank
	} from "../../utils/uniApi";

	import uNavbar from '@/uview-ui/components/u-navbar/u-navbar.vue'
	import uAvatar from '../../uview-ui/components/u-avatar/u-avatar.vue'
	import uSelect from '../../uview-ui/components/u-select/u-select.vue'
	import uEmpty from '../../uview-ui/components/u-empty/u-empty.vue'



	@Component({
		//   @Component  是一个装修器   不可以在下面写语句
		name: "test",
		components: {
			TimeTest: TimeTest,
			'u-navbar': uNavbar,
			'u-avatar': uAvatar,
			'u-select': uSelect,
			'u-empty': uEmpty
		},
	})
	export default class extends Vue {
		@Prop({
			type: String, // 父组件传递给子组件的数据类型
			required: false, // 是否必填
			default: " ", // 默认值， 如果传入的是 Object，则要 default: ()=>({}) 参数为函数
		})
		msg!: string;





		public src = "";

		public selectTime = "";

		public showData: any = [];

		//日期
		public dateTime = "";
		public dateType: string = ""; //month 按月查询,day 按天查询

		mounted() {
			//    this.nowDate()
			this.accordingM();
		}

		getMsgFormSon(data: any, timeType: string) {
			// alert('999')
			console.log("子组件的数据", data, timeType);
			this.dateType = timeType;
			this.dateTime = data;
		}

		selectTimeM() {

		}

		accordingM() {
			// uni.showLoading({
			//   title: "加载中",
			// });

			// this.allData= []

			let params = {
				userId: uni.getStorageSync("userId") == "" ?
					"" :
					parseInt(uni.getStorageSync("userId")),
				dateType: this.dateType,
				dateTime: this.dateTime, //查询时间
			};

			porxyNewShopRank(params)
				.then((res: any) => {
					console.log(res, "商户列表");
					this.showData = res.data.data;
					// res.data.data.filter((item: any, index: any) => {
					//   this.showData.push(item);
					// });
				})
				.then(() => {
					uni.hideLoading();
				});
		}

		BackM() {
			console.log("12312321");

			uni.switchTab({
				url: "../../pages/stati/index",
			});
		}

		onBackPress() {

			console.log('1111-onBackPressonBackPress')

			uni.switchTab({
				url: "./index",
			});
			return true;

		}

	}
</script>
<style scoped>
	.seniority-item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		border-bottom: 1px solid #dbdbdb;
		padding: 0.5rem;
	}

	.seniority-price {
		font-size: 0.78rem;
		font-family: PingFang SC;
		font-weight: 399;
		color: #000000;
	}

	.seniority-s {
		font-size: 0.78rem;
		font-family: PingFang SC;
		font-weight: 400;
		color: #000000;
	}

	.seniority-p {
		font-size: 0.78rem;
		font-family: PingFang SC;
		font-weight: 300;
		color: #000000;
	}

	.totle-price {
		display: flex;
		justify-content: space-between;
		align-items: center;
		background-color: #f3f5f7;
		padding: 0.3rem 0.5rem;
	}

	.totle-price-text {
		font-size: 0.73rem;
		font-family: PingFang SC;
		font-weight: 400;
		color: #000000;
	}

	.totle-price-text span {
		font-size: 0.73rem;
		font-family: PingFang SC;
		font-weight: 300;
		color: #000000;
	}
</style>
